<script setup>
import {ref} from 'vue'

let date = ref(new Date())
let toTitleDate = d => {
  return d.getTime()
}

function formatDate(date) {
  let yy = date.getFullYear()
  let mm = date.getMonth() + 1
  let dd = date.getDate()
  return `${yy}年${mm}月${dd}日`
}
let n = 'align'
let v = 'right'
</script>

<template>
  <div v-bind:[n]="v" >动态参数绑定</div>

  <hr>
  <time :title="toTitleDate(date)" v-bind:datetime="date">
    {{ formatDate(date) }}
  </time>
</template>
